unit Unit54; 

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Unit1;

type

  { TForm54 }

  TForm54 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    ComboBox1: TComboBox;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  Form54: TForm54; 

implementation

{ TForm54 }

procedure TForm54.Button1Click(Sender: TObject);
var
  QueryString : string;
  
begin
  if Edit2.Text <> '' then
  begin
    QueryString := 'update sucursal set suc_nombre = ''' + Edit2.Text + ''', suc_descripcion = '''
      + ComboBox1.Text + ''' where suc_cdg = ' + Edit1.Text;
      
    Form1.PQConnection1.ExecuteDirect('begin work;');
    Form1.PQConnection1.ExecuteDirect(QueryString);
    Form1.PQConnection1.ExecuteDirect('commit work;');
    
    ShowMessage('MODIFICACION EXITOSA');
    
    Close;
  end;
end;

procedure TForm54.Button2Click(Sender: TObject);
begin
  Close;
end;

procedure TForm54.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
  Edit1.Text := '';
  Edit2.Text := '';
  ComboBox1.Text := '';
end;

initialization
  {$I unit54.lrs}

end.

